/**
 * Created by tom on 2017/5/7.
 */

var mongoose = require('mongoose')
var config = require('../config/config')

mongoose.Promise = require('bluebird')

var db = mongoose.connect(config.mongodbUrl)

mongoose.connection.on('connected', function() {
    console.log('Mongoose connected to ' + config.mongodbUrl);
});
mongoose.connection.on('error', function(err) {
    console.log('Mongoose connection error: ' + err);
});
mongoose.connection.on('disconnected', function() {
    console.log('Mongoose disconnected');
});


module.exports  = db